package com.wdh.kjs.activity;

import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.wdh.kjs.R;
import com.wdh.kjs.fragment.Hc_explain_Fragment;
import com.wdh.kjs.fragment.Hc_feeinstruction_Fragment;
import com.wdh.kjs.fragment.Hc_more_Fragment;
import com.wdh.kjs.fragment.Hc_registeranth_Fragment;
import com.wdh.kjs.fragment.Hc_wantfinance_Fragment;
import com.wdh.kjs.fragment.Hc_wantinvest_Fragment;


/**
 * Created by CQH on 2016/4/21.
 */
public class HelpCenterActivity extends BaseTopActivity implements View.OnClickListener {
    private TextView bt_id_register_auth;
    private TextView bt_id_want_invest;
    private TextView bt_id_want_finance;
    private TextView bt_id_explain;
    private TextView bt_id_fee_instruction;
    private TextView bt_id_more;
    private FragmentManager manager;
    private FragmentTransaction transaction;
    private Hc_registeranth_Fragment fragmentOne;
    private Hc_wantinvest_Fragment fragmentTwo;
    private Hc_wantfinance_Fragment fragmentThree;
    private Hc_explain_Fragment fragmentFour;
    private Hc_feeinstruction_Fragment fragmentFive;
    private Hc_more_Fragment fragmentSix;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_helpcenter);
        initTopBar("帮助中心");
        initView();

    }

    public void initView(){
        bt_id_register_auth = (TextView)findViewById(R.id.bt_id_register_auth);
        bt_id_want_invest = (TextView)findViewById(R.id.bt_id_want_invest);
        bt_id_want_finance = (TextView)findViewById(R.id.bt_id_want_finance);
        bt_id_explain = (TextView)findViewById(R.id.bt_id_explain);
        bt_id_fee_instruction = (TextView)findViewById(R.id.bt_id_fee_instruction);
        bt_id_more = (TextView)findViewById(R.id.bt_id_more);

//        Log.i("msg","hahaha3");

        bt_id_register_auth.setOnClickListener(this);
        bt_id_want_invest.setOnClickListener(this);
        bt_id_want_finance.setOnClickListener(this);
        bt_id_explain.setOnClickListener(this);
        bt_id_fee_instruction.setOnClickListener(this);
        bt_id_more.setOnClickListener(this);

        Log.i("msg","hahaha2");

        manager=getFragmentManager();
        transaction=manager.beginTransaction();
        fragmentOne=new Hc_registeranth_Fragment();
        transaction.add(R.id.hc_id_list, fragmentOne);
        transaction.commit();
        bt_id_register_auth.setTextColor(getResources().getColor(R.color.colorPrimary));
        Log.i("msg","hahaha1");

    }

    @Override
    public void onClick(View view) {
        transaction=manager.beginTransaction();
        switch (view.getId())
        {
            case R.id.bt_id_register_auth:
                bt_id_register_auth.setTextColor(getResources().getColor(R.color.colorPrimary));
                bt_id_want_invest.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_finance.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_explain.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_fee_instruction.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_more.setTextColor(getResources().getColor(R.color.text_color));

                fragmentOne=new Hc_registeranth_Fragment();
                transaction.replace(R.id.hc_id_list, fragmentOne, "fragmentOne");
                transaction.addToBackStack("fragmentOne");
                break;
            case R.id.bt_id_want_invest:
                bt_id_register_auth.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_invest.setTextColor(getResources().getColor(R.color.colorPrimary));
                bt_id_want_finance.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_explain.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_fee_instruction.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_more.setTextColor(getResources().getColor(R.color.text_color));

                fragmentTwo=new Hc_wantinvest_Fragment();
                transaction.replace(R.id.hc_id_list, fragmentTwo, "fragmentTwo");
                transaction.addToBackStack("fragmentTwo");
                break;
            case R.id.bt_id_want_finance:
                bt_id_register_auth.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_invest.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_finance.setTextColor(getResources().getColor(R.color.colorPrimary));
                bt_id_explain.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_fee_instruction.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_more.setTextColor(getResources().getColor(R.color.text_color));

                fragmentThree=new Hc_wantfinance_Fragment();
                transaction.replace(R.id.hc_id_list, fragmentThree, "fragmentThree");
                transaction.addToBackStack("fragmentThree");
                break;
            case R.id.bt_id_explain:
                bt_id_register_auth.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_invest.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_finance.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_explain.setTextColor(getResources().getColor(R.color.colorPrimary));
                bt_id_fee_instruction.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_more.setTextColor(getResources().getColor(R.color.text_color));

                fragmentFour=new Hc_explain_Fragment();
                transaction.replace(R.id.hc_id_list, fragmentFour, "fragmentFour");
                transaction.addToBackStack("fragmentFour");
                break;
            case R.id.bt_id_fee_instruction:
                bt_id_register_auth.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_invest.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_finance.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_explain.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_fee_instruction.setTextColor(getResources().getColor(R.color.colorPrimary));
                bt_id_more.setTextColor(getResources().getColor(R.color.text_color));

                fragmentFive=new Hc_feeinstruction_Fragment();
                transaction.replace(R.id.hc_id_list, fragmentFive, "fragmentFive");
                transaction.addToBackStack("fragmentFive");
                break;
            case R.id.bt_id_more:
                bt_id_register_auth.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_invest.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_want_finance.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_explain.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_fee_instruction.setTextColor(getResources().getColor(R.color.text_color));
                bt_id_more.setTextColor(getResources().getColor(R.color.colorPrimary));

                fragmentSix=new Hc_more_Fragment();
                transaction.replace(R.id.hc_id_list, fragmentSix, "fragmentSix");
                transaction.addToBackStack("fragmentSix");
                break;
        }
        transaction.commit();
    }
}
